package patrol.mobile.com.mobilepatrol.activity.security.emergency;

import android.support.v7.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.dl7.recycler.helper.RecyclerViewHelper;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.util.List;

import butterknife.BindView;
import patrol.mobile.com.mobilepatrol.R;
import patrol.mobile.com.mobilepatrol.activity.security.StickyEventBan;
import patrol.mobile.com.mobilepatrol.activity.security.StickyEventBody;
import patrol.mobile.com.mobilepatrol.activity.security.adapter.DayAdapter;
import patrol.mobile.com.mobilepatrol.bean.FestivalDuty2Bean;
import patrol.mobile.com.mobilepatrol.bean.PeopleInfoBean;
import patrol.mobile.com.mobilepatrol.fragment.BaseFragment;

public class BaiBanFragment extends BaseFragment {
    @BindView(R.id.recyclerView)
    RecyclerView recyclerView;

    @Override
    protected void initView() {
        super.initView();
        EventBus.getDefault().register(this);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_baiban;
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initListener() {

    }

    @Subscribe(threadMode = ThreadMode.MAIN,sticky = true)
    public void ReceviceMessage(StickyEventBan stickyEventBan){
        List<FestivalDuty2Bean.AbkHolidayRotaDayListBean> abkHolidayRotaDayListBeans =stickyEventBan.festivalDuty2Bean.getAbkHolidayRotaDayList();
        DayAdapter   dayAdapter = new DayAdapter(getContext());
        RecyclerViewHelper.initRecyclerViewV(getContext(), recyclerView,
                false, dayAdapter);
        recyclerView.setAdapter(dayAdapter);
        dayAdapter.updateItems(abkHolidayRotaDayListBeans);
    }


    @Override
    public void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().removeAllStickyEvents();
        EventBus.getDefault().unregister(this);
    }
}
